Programming Paradigms

MOC Programming

Created: 2022-09-19
Tags: #fleeting


This are strategies to use when solving a problem using a programming languange:

  • Imperative
  • Logical
  • Functional
  • Object-Oriented

Imperative Programming

It is one of the first paradigms in programming. It features close relation to machine architecture. It is based on Von Neumann architecture. Through assignment statements, it alters the state of the program. By altering states, it completes tasks step by step. The method of achieving the goal is the major concern. The paradigm is made up of a number of statements, and once each one is executed, a result is saved.
The imperative programming paradigm makes the assumption that a computer can keep any changes to a computation process through environments of variables. These variables are referred to or modified throughout a guided series of steps that constitute computations. The sequence in which the steps are performed is essential because the effects of each step vary based on the values of the variables at their present times.

Logical Programming Paradigm

The Logical Paradigm approaches problem-solving declaratively. A scenario is described using a number of logical arguments that establish all known facts. Inquiries are then made. The computer’s job becomes data maintenance and logical reasoning.

It is a type of abstract computing model. It would resolve logical issues like series, riddles, and more. In logic programming, we have a knowledge base that we are familiar with, and when the machine is given a query and this knowledge base, it will return an answer. Such a knowledge base idea is not present in conventional programming languages, but when artificial intelligence and machine learning are used, we have models like the perception model that employ the same technique.

The knowledge base and the issue are emphasized most in logical programming. The program’s execution closely resembles the mathematical proof of a proposition, such as Prolog.

Functional Programming Paradigm

This uses functions and only functions to solve problems

Object-Oriented Paradigm

Through a process known as inheritance, a new class ( also known as a derived class or subclass) can be descended from an existing class (also known as a base class or superclass). The derived class inherits the structure and behavior of the base class, as well as all of its other properties (response to messages). The derived class may also display extra behavior and include additional state (instance variables) (new methods to resond to new messages). There would be a separate method to reply to the same message, which is significant since the derived class can also override behavior corresponding to some of the base class’s methods. Additionally, the inheritance technique may be used without having access to the base class’s source code.